#include<iostream>

using namespace std;

const int N=101;
int q[N],b[N];


int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		cin>>q[i];
		b[(i+m)%n]=q[i];
	}
	int first=0;
	for(int i=0;i<n;i++){
		if(first)
		{
			cout<<" "<<b[i];
		}else{
			cout<<b[i];
			first=1;
		}
	}

}